import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class Test extends StatelessWidget {
  const Test({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    String? title = "androidView";

    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: iosView(),
      ),
    );
  }

  Widget iosView() {
    if (defaultTargetPlatform == TargetPlatform.android) {
      return const AndroidView(
        viewType: 'plugins.flutter.io/custom_platform_view',
        creationParams: {
          'url': 'https://www.baidu.com',
          'text': '这是从flutter传递的title'
        },
        creationParamsCodec: StandardMessageCodec(),
        // viewType: "<platform-view-type>",
      );
    } else {
      return Container();
    }
  }
}
